var mongoose = require("../bin/mongoose")
//获取Schema构造函数
var Schema = mongoose.Schema



//创建数据表的描述对象
var userSchema = new Schema({
	id:Number,
	email:String,
	password:String,
	name:String,
	avatar:{type:String,default:"/img/avatar/avatar-default.png"},
	createTime:String
})
//创建数据表的操作对象
var User  = mongoose.model("user",userSchema)

/*
  * commment  提问
 * id  
 * user_id
 * commentTitle  提问标题      commentFile  commentKnowledgeId  commentStepId
 * commentDesc   提问描述
 * commentImg    提问截图（）
 * commentKnowledge 问题的涉及标签
 * createTime*/

var commentSchema = new Schema({
	id:{type:Number,required:true},
	user_id:{type:Number,required:true},
	title:{type:String,required:true},
	desc:{type:String,required:true},
	img:Array,
	konwledgeTag:{type:Array,required:true},
	createTime:String
})
var Comment = mongoose.model("comment",commentSchema)


/*

 * Answers
 * id
 * comment_id
 * user_id
 * desc
 * code
 * createTime

 * */
var answerSchema = new Schema({
	id:{type:Number,required:true},
	user_id:{type:Number,required:true},
	comment_id:{type:Number,required:true},
	desc:{type:String,required:true},
	code:String,
	createTime:String
})
var Answer = mongoose.model("answer",answerSchema)


module.exports.User = User
module.exports.Comment = Comment
module.exports.Answer =Answer

